home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13987 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  48 lines

  1. Path: mail2news.demon.co.uk!devmaccn.demon.co.uk
  2. From: Alan Griffiths <aGriffiths@ma.ccngroup.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: MS VC++ 4.0 namespace weirdness
  5. Date: Thu, 28 Mar 1996 10:06:33 GMT
  6. Organization: CCN Market Analysis
  7. Distribution: world
  8. Message-ID: <475745934wnr@ma.ccngroup.com>
  9. References: <4iq8up$hl3@news1.h1.usa.pipeline.com> <4ip987$aj5@druid.borland.com>
  10. Reply-To: aGriffiths@ma.ccngroup.com
  11. X-NNTP-Posting-Host: devmaccn.demon.co.uk
  12. X-Broken-Date: Thursday, Mar 28, 1996 10.06.33 GMT
  13. X-Newsreader: Newswin Alpha 0.6
  14. X-Mail2News-Path: devmaccn.demon.co.uk
  15.  
  16. In article: <4iq8up$hl3@news1.h1.usa.pipeline.com>  grantp@usa.pipeline.com(Pete Grant) writes:
  17. > [snip]
  18. > I have used namespace declarations inside header files, as in FOO1 above,  
  19. > and have had no problems.  The namespaces behave precisely as expected when
  20. > compiled with MSVC++4.0/4.1.  
  21.  
  22. Then your expectation is wrong...
  23.  
  24. #include <assert.h>
  25.  
  26. namespace MyNamespace
  27. {
  28.    int i = 1;
  29. }
  30.  
  31. int main()
  32. {
  33.    int i = 2;
  34.  
  35.    using namespace MyNamespace;
  36.  
  37.    assert(2 == i);  // fails with MSVC4
  38.  
  39.    return 0;
  40. }
  41.  
  42. Alan Griffiths               | Also editor of: The ISDF Newsletter
  43. Senior Systems Consultant,   | (An Association of C and C++ Users publication)
  44. CCN Group Limited.           | (ISDF editor  : isdf@octopull.demon.co.uk)
  45. (agriffiths@ma.ccngroup.com) | (For ACCU see : http://bach.cis.temple.edu/accu)
  46.  
  47.